<!DOCTYPE html>
<html>
<head>
  <title>比赛信息</title>
  <#include "/header.html" />
</head>
<body>
<div id="rrapp" class="container" v-cloak>
  <div style="margin-bottom: 20px">
    <a href="javascript:history.go(-1);">返回比赛列表</a>
    <button class="btn btn-default" style="display: block; float: right" onclick="history.go(0)">刷新</button>
  </div>
  <h1 style="font-size: 30px">{{currentRace.name}}</h1>
  <table class="layui-table" lay-skin="line">
    <thead>
      <tr>
        <th>开始时间</th>
        <th>比赛地点</th>
        <th>报名人数</th>
        <th>比赛结果</th>
      </tr>
    </thead>
    <tbody>
      <tr>
        <td>{{currentRace.startTime}}</td>
        <td>{{currentRace.place}}</td>
        <td>{{currentRace.count}} &nbsp; <a href="#" v-on:click="showAllPlayers()"  >查看报名情况</a></td>
        <td><button class="btn btn-default" v-on:click="showAllPlayers('order')">查看比赛结果</button></td>
      </tr>
    </tbody>
  </table>
  <div class="panel-group" id="accordion" role="tablist" aria-multiselectable="true">
    <div class="panel panel-default">
      <div class="panel-heading" role="tab" id="headingOne">
        <h4 class="panel-title">
          <a role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseOne" aria-expanded="true" aria-controls="collapseOne">
            比赛轮次
          </a>
        </h4>
      </div>
      <div id="collapseStage" class="panel-collapse collapse in" role="tabpanel" aria-labelledby="headingOne">
        <div class="panel-body">
          <div v-show="showList">
            <div class="grid-btn">
              <#if shiro.hasPermission("race:stage:save")>
                <a class="btn btn-primary" @click="add"><i class="fa fa-plus"></i>&nbsp;新增</a>
              </#if>
              <#if shiro.hasPermission("race:stage:update")>
                <a class="btn btn-primary" @click="update"><i class="fa fa-pencil-square-o"></i>&nbsp;修改</a>
              </#if>
              <#if shiro.hasPermission("race:stage:delete")>
                <a class="btn btn-primary" @click="del"><i class="fa fa-trash-o"></i>&nbsp;删除</a>
              </#if>
            </div>
            <table id="jqGrid-stage"></table>
            <div id="jqGridPager-stage"></div>
          </div>

          <div v-show="!showList" class="panel panel-default">
            <div class="panel-heading">{{title}}</div>
            <form class="form-horizontal">
              <div class="form-group">
                <div class="col-sm-2 control-label">轮次名称</div>
                <div class="col-sm-10">
                  <input type="text" class="form-control" v-model="stage.name" placeholder="轮次名称"/>
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-2 control-label">顺序</div>
                <div class="col-sm-10">
                  <input type="text" class="form-control" v-model="stage.order" placeholder="顺序"/>
                </div>
              </div>
              <div class="form-group">
                <div class="col-sm-2 control-label">比赛</div>
                <div class="col-sm-10">
                  <select class="form-control" v-model="stage.raceId" disabled>
                    <option v-for="r in selectableRaceList" v-bind:value="r.id">
                      {{r.name}}
                    </option>
                  </select>
                </div>
              </div>
              <input type="text" class="form-control" v-model="stage.status" value="1" style="display: none;"/>
              <div class="form-group">
                <div class="col-sm-2 control-label"></div>
                <input type="button" class="btn btn-primary" @click="saveOrUpdate" value="确定"/>
                &nbsp;&nbsp;<input type="button" class="btn btn-warning" @click="reload" value="返回"/>
              </div>
            </form>
          </div>
        </div>
      </div>
    </div>
    <div class="panel panel-default">
      <div class="panel-heading" role="tab" id="headingTwo">
        <h4 class="panel-title">
          <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo">
            比赛场次
          </a>
        </h4>
      </div>
      <div id="collapseCompetition" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingTwo">
        <div class="panel-body">
          <div>
            <div>
              <!--
              <button class="btn btn-primary" >添加场次</button>
              -->
              <button class="btn btn-primary" v-on:click="arrange(currentStage)" >安排场次</button>
              <hr>
            </div>
            <div class="col-md-4" v-for="c in competitions">
              <div class="panel panel-default">
                <div class="panel-heading">{{c.name}}&nbsp;&nbsp;{{c.ground.name}}</div>
                <div class="panel-body">
                  <table class="table" lay-skin="line">
                    <thead>
                      <tr>
                        <th>主场</th>
                        <th>客场</th>
                        <th>胜方</th>
                      </tr>
                    </thead>
                    <tbody>
                      <tr>
                        <td>{{c.host.name}}</td>
                        <td>{{c.guest.name}}</td>
                        <td><span v-if="c.winner!=undefined">{{c.winner.name}}</span></td>
                      </tr>
                    </tbody>
                  </table>
                  <hr>
                  <table class="table table-striped">
                    <thead>
                      <tr>
                        <td>局</td>
                        <td>{{c.host.name}}</td>
                        <td>{{c.guest.name}}</td>
                        <td>操作</td>
                      </tr>
                    </thead>
                    <tbody>
                      <tr v-for="p in c.points">
                        <td>{{p.order}}</td>
                        <td>{{p.host}}</td>
                        <td>{{p.guest}}</td>
                        <td><button class="btn btn-default btn-xs" v-on:click="addRound(c, p.id)">修改</button></td>
                      </tr>
                    </tbody>
                  </table>
                  <span class="glyphicon glyphicon-plus btn btn-default btn-xs" aria-hidden="true" v-on:click="addRound(c)" ></span>&nbsp;&nbsp;
                  <span class="btn btn-default btn-xs" aria-hidden="true" v-on:click="finishCompetition(c)" v-if="c.status == 2" >结束比赛</span>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
    <!--
    <div class="panel panel-default">
      <div class="panel-heading" role="tab" id="headingThree">
        <h4 class="panel-title">
          <a class="collapsed" role="button" data-toggle="collapse" data-parent="#accordion" href="#collapseThree" aria-expanded="false" aria-controls="collapseThree">
            Collapsible Group Item #3
          </a>
        </h4>
      </div>
      <div id="collapseThree" class="panel-collapse collapse" role="tabpanel" aria-labelledby="headingThree">
        <div class="panel-body">
          Anim pariatur cliche reprehenderit, enim eiusmod high life accusamus terry richardson ad squid. 3 wolf moon officia aute, non cupidatat skateboard dolor brunch. Food truck quinoa nesciunt laborum eiusmod. Brunch 3 wolf moon tempor, sunt aliqua put a bird on it squid single-origin coffee nulla assumenda shoreditch et. Nihil anim keffiyeh helvetica, craft beer labore wes anderson cred nesciunt sapiente ea proident. Ad vegan excepteur butcher vice lomo. Leggings occaecat craft beer farm-to-table, raw denim aesthetic synth nesciunt you probably haven't heard of them accusamus labore sustainable VHS.
        </div>
      </div>
    </div>
    -->
  </div>

  <div id="round-form" style="display: none">
    <form class="form-horizontal">
    <div class="form-group">
      <label for="inputEmail3" class="col-sm-6 control-label">{{newRound.hostName}}</label>
      <div class="col-sm-6">
        <input type="number" class="form-control" id="inputEmail3" v-model='newRound.hostPoint' placeholder="成绩">
      </div>
    </div>
    <div class="form-group">
      <label for="inputPassword3" class="col-sm-6 control-label">{{newRound.guestName}}</label>
      <div class="col-sm-6">
        <input type="number" class="form-control" id="inputPassword3" v-model='newRound.guestPoint' placeholder="成绩">
      </div>
    </div>
    </form>
  </div>
</div>

<script>

</script>

<script src="${request.contextPath}/statics/plugins/tinymce/tinymce.min.js"></script>
<script src="${request.contextPath}/statics/js/modules/race/raceInfo.js?_${.now?long}"></script>
</body>
</html>